//
// Description: 100. 相同的树
// Created by Loading on 2025/5/27.
//

#include <bits/stdc++.h>
#include <Utils.h>

using namespace std;

bool isSameTree(TreeNode *p, TreeNode *q) {
    if (p && q) {
        return p->val == q->val && isSameTree(p->left, q->left) && isSameTree(p->right, q->right);
    } else if (!p && !q) {
        return true;
    }
    return false;
}

int main() {
    auto p = generateTreeNode({1, 2, -1, 3});
    auto q = generateTreeNode({1, 2, -1, 3});

    auto res = isSameTree(p, q);

    cout << res << endl;

    return 0;
}
